<?php

namespace common\models\shop;

use common\models\business\BusinessAdress;
use Yii;

/**
 * This is the model class for table "shop_since_address".
 *
 * @property string $id
 * @property string $province
 * @property string $city
 * @property string $conty
 * @property string $area
 */
class ShopSinceAddress extends \yii\db\ActiveRecord
{


    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '提货地址管理',      //用于修改了什么的显示
        'mainfield' => 'id',      //主要的显示标题的字段
        'picturefield' => [],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];


    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'shop_since_address';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['province', 'city', 'conty', 'area'], 'required'],
            [['province', 'city', 'conty', 'area','remark'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'province' => '省',
            'city' => '市',
            'conty' => '县',
            'area' => '街道',
            'remark' => '备注'
        ];
    }



    public function getProvincea()
    {
        return $this->hasOne(BusinessAdress::className(),['id'=>'province']);
    }

    public function getCitya()
    {
        return $this->hasOne(BusinessAdress::className(),['id'=>'city']);
    }

    public function getContya()
    {
        return $this->hasOne(BusinessAdress::className(),['id'=>'conty']);
    }
}
